<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
</head>

<body>
</body>
</html>
<script>
	var h2 =document.createElement("h2");
	var tt=document.createTextNode("Hello Javascript");
	var al=document.createAttribute("align");
	al.value="center";
	h2.appendChild(tt);
	h2.setAttribute(al);
	document.getElementsByTagName('body')[0].appendChild(h2);
	
	
	
</script>
